﻿
var index;
//Appearance/Logo
$('#DataImportForm').ajaxForm({

    beforeSubmit: function (formData, jqForm, options) {

  
        var $fileInput = $('#DataImportForm input[name=selectExecl]');
        var files = $fileInput.get()[0].files;

        if (!files.length) {           
            layer.msg("请选择execl文件", { icon: 7 });
            return false;
        }

        var file = files[0];

        var type = file.name.substring(file.name.lastIndexOf(".")).toLowerCase();
        if (type != '.xlsx') {         
            layer.msg("请选择后缀名为.xlsx格式的excel文件", { icon: 7 });
            return false;
        }

        //File size check
        if (file.size > 1024 * 1024 * 5) //5m
        {          
            layer.msg("文件不能超过5m", { icon: 7 });
            return false;
        }
        $('#verifyResult').val("");
        index =layer.msg("导入中...", {
            icon: 16
            , shade: 0.5,
            time: false //取消自动关闭
        });

        return true;
    },
    success: function (response) {

        $('#verifyResult').val(response);
        layer.close(index);//手动关闭
      
    }
});

 